//: Playground - noun: a place where people can play

import UIKit

var dict:[AnyHashable : Int] = [2:3, 3:4, "4":5]
//(dict as NSDictionary).setValue(9, forKey: "8");
dict[5] = 6;//如果没有这个key会添加key和value
dict[1]

dict.removeValue(forKey: 1);
dict.removeValue(forKey: 2);

for i in dict.keys {
    print(i)
}

print("==")
for i in dict.values {
    print(i)
}

print("==")
for(key, value) in dict {
    print("\(key)=>\(value)")
}

// 字典的合并
var dict2:[AnyHashable : Int] = [7:3, 8:4, "9":5]
//let dict3 = dict + dict2; //Error

for (key, value) in dict2 {
    dict[key] = value;
}

dict;




